﻿Imports Microsoft.SqlServer.Management.Smo

Public Class AuditGardDB
    Inherits Collections.SortedList

    ' Backing storage -- a generic list
    Dim Servers As New List(Of String)

    Public Sub New()
        Initialize()
    End Sub

    Private Sub Initialize()
        ' Add an item to the Collection
        FormMain.TreeList1.Columns.Add()
        FormMain.TreeList1.Columns(0).Caption = "Server"

        Dim dt As DataTable = SmoApplication.EnumAvailableSqlServers(False)
        If dt.Rows.Count > 0 Then
            For Each dr As DataRow In dt.Rows
                FormMain.TreeList1.BeginUnboundLoad()

                FormMain.TreeList1.AppendNode(New Object() {dr.ItemArray(0).ToString}, -1)
                FormMain.TreeList1.EndUnboundLoad()
            Next
        End If

    End Sub

End Class
